import pandas as pd
import matplotlib.pyplot as plt
import geopandas as gpd
import folium
import contextily as cx
import rtree
from zlib import crc32
import hashlib
from shapely.geometry import Point, LineString, Polygon
## Importing our DataFrames
#gisfilepath = "/Users/jnapolitano/Projects/data/energy/Natural_Gas_Pipelines.geojson"
gisfilepath = '/Users/jnapolitano/Projects/data/energy/Natural_Gas_Liquid_Pipelines.zip'
ng_pipeline_df = gpd.read_file(gisfilepath)
ng_pipeline_df = ng_pipeline_df.to_crs(epsg=3857)
#colums = ng_pipeline_df.columns
#uniqe = ng_market_df.TYPE.unique()
ng_pipeline_df = ng_pipeline_df[ng_pipeline_df.TYPEPIPE == 'Interstate']
ng_pipeline_df.dropna(inplace=True)
ng_pipeline_df.head()
| TYPEPIPE | Operator | Shape_Leng | geometry | |
|---|---|---|---|---|
| 737 | Interstate | Enbridge Pipelines (AlaTenn) | 0.171766 | LINESTRING (-9656362.029 4119699.311, -9653795... |
| 738 | Interstate | Enbridge Pipelines (AlaTenn) | 0.174189 | LINESTRING (-9675726.277 4118469.233, -9673070... |
| 739 | Interstate | Enbridge Pipelines (AlaTenn) | 0.175478 | LINESTRING (-9675726.277 4118469.233, -9683221... |
| 740 | Interstate | Enbridge Pipelines (AlaTenn) | 0.057599 | LINESTRING (-9682131.156 4118105.433, -9675726... |
| 741 | Interstate | Enbridge Pipelines (AlaTenn) | 0.099992 | LINESTRING (-9692746.582 4114035.142, -9690740... |
{eval-rst}
.. index::
single: Natural Gas Terrain Interactive Map
ng_pipeline_map =ng_pipeline_df.explore(
#column="Operator", # make choropleth based on "PORT_NAME" column
popup=False, # show all values in popup (on click)
tiles='Stamen Terrain',
#tiles="CartoDB positron", # use "CartoDB positron" tiles
#cmap='Reds', # use "Set1" matplotlib colormap
#m=ng_pipeline_map,
#style_kwds=dict(color="black"),
#marker_kwds= dict(radius=2),
#tooltip=['','State','Hub_name','Operator','Maxthru','Avgdaily','Numcust','Platform'],
#legend =False, # use black outline)
#categorical=True,
color='grey'
)
#ng_pipeline_map
## Importing our DataFrames
gisfilepath = "/Users/jnapolitano/Projects/data/energy/Natural_Gas_Market_Hubs.geojson"
ng_market_df = gpd.read_file(gisfilepath)
ng_market_df = ng_market_df.to_crs(epsg=3857)
ng_market_df.describe()
| FID | OBJECTID | Yr_activat | Maxthru | Avgdaily | Numcust | Yearofdata | Latitude | Longitude | |
|---|---|---|---|---|---|---|---|---|---|
| count | 27.000000 | 27.000000 | 27.000000 | 27.000000 | 27.000000 | 27.000000 | 27.000000 | 27.000000 | 27.000000 |
| mean | 14.000000 | 14.000000 | 1995.333333 | 1409.111111 | 951.481481 | 74.777778 | 2007.888889 | 36.538033 | -100.874230 |
| std | 7.937254 | 7.937254 | 4.047791 | 959.288492 | 769.353893 | 133.527391 | 1.012739 | 6.368855 | 13.339038 |
| min | 1.000000 | 1.000000 | 1988.000000 | 0.000000 | 0.000000 | 0.000000 | 2003.000000 | 27.548800 | -122.220000 |
| 25% | 7.500000 | 7.500000 | 1994.000000 | 615.000000 | 320.000000 | 10.000000 | 2008.000000 | 30.213150 | -109.284500 |
| 50% | 14.000000 | 14.000000 | 1994.000000 | 1200.000000 | 600.000000 | 40.000000 | 2008.000000 | 36.686400 | -97.600300 |
| 75% | 20.500000 | 20.500000 | 1996.000000 | 2112.500000 | 1525.000000 | 61.000000 | 2008.000000 | 41.478950 | -92.024700 |
| max | 27.000000 | 27.000000 | 2008.000000 | 3100.000000 | 2500.000000 | 660.000000 | 2009.000000 | 49.000500 | -74.178500 |
{eval-rst}
.. index::
single: Pipelines by Market Hub Interactive Map
ng_market_map =ng_market_df.explore(
column="Hub_name", # make choropleth based on "PORT_NAME" column
popup=False, # show all values in popup (on click)
tiles="Stamen Terrain", # use "CartoDB positron" tiles
cmap='Reds', # use "Set1" matplotlib colormap
m=ng_pipeline_map,
#style_kwds=dict(color="black"),
marker_kwds= dict(radius=15),
tooltip=['Region','State','Hub_name','Operator','Maxthru','Avgdaily','Numcust','Platform'],
legend =True, # use black outline)
categorical=True,
)
ng_market_map